package com.gzx.plugin.data.wckj.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gzx.plugin.data.wckj.entity.JudgeLoanInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface WckjJudgeLoanInfoDao extends BaseMapper<JudgeLoanInfo> {

    @Insert("<script>" +
            "INSERT INTO data_wckj_jkxx " +
            "(ywyh_id, loan_no, contract_no, loan_key, funder, total_period, " +
            "loan_date, loan_amount, contract_rate, bank_account, bank_name, " +
            "create_time, update_time) " +
            "VALUES " +
            "<foreach collection='judgeLoanInfoList' item='wckjJkxx' separator=','>" +
            "(" +
            "#{wckjJkxx.ywyhId}, " +
            "#{wckjJkxx.loanNo}, " +
            "#{wckjJkxx.contractNo}, " +
            "#{wckjJkxx.loanKey}, " +
            "#{wckjJkxx.funder}, " +
            "#{wckjJkxx.totalPeriod}, " +
            "#{wckjJkxx.loanDate}, " +
            "#{wckjJkxx.loanAmount}, " +
            "#{wckjJkxx.contractRate}, " +
            "#{wckjJkxx.bankAccount}, " +
            "#{wckjJkxx.bankName}, " +
            "now(), " +      // 数据库生成创建时间
            "now()" +        // 数据库生成更新时间
            ")" +
            "</foreach>" +
            "</script>")
    void batchSave(@Param("judgeLoanInfoList") List<JudgeLoanInfo> judgeLoanInfoList);
}
